﻿/*  
	========================================================================
	 awzBoxes Library
	
	 Homepage: http://www.awzhome.de/
	========================================================================
	
	This Source Code Form is subject to the terms of the Mozilla Public
	License, v. 2.0. If a copy of the MPL was not distributed with this
	file, You can obtain one at http://mozilla.org/MPL/2.0/.
   
	The Original Code is code of awzBoxes Library.

	The Initial Developer of the Original Code is Andreas Weizel.
	Portions created by the Initial Developer are
	Copyright (C) 2011-2012 Andreas Weizel. All Rights Reserved.
	
	Contributor(s): (none)
	
	========================================================================
*/

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;
using System.Windows;

namespace AWZhome.awzBoxes.Tools
{
	/// <summary>
	/// Compares a bound <see cref="AWZhome.awzBoxes.BoxItemDockDirection"/> value
	/// to a predefined value to get a <see cref="System.Windows.Visibility"/> value.
	/// </summary>
	public class BoxItemDockOptionConverter : IValueConverter
	{
		#region IValueConverter Member

		public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
		{
			Visibility result = Visibility.Collapsed;

			if ((value is BoxItemDockDirection)
				&& ((((BoxItemDockDirection) value) & this.ComparedValue) == this.ComparedValue))
			{
				result = Visibility.Visible;
			}

			return result;
		}

		public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
		{
			throw new NotImplementedException();
		}

		#endregion

		public BoxItemDockDirection ComparedValue
		{
			get;
			set;
		}
	}
}
